<?php

require("config.php");



$pageno = get_get("page");
$username = get_get("user");

$result = $db->query("select count(*) as count from po_blog where status>=0 and username='%s'", $username);
if ($result) {
	$row = $db->fetch_assoc($result);
	$pagecount = $row['count'];
} else {
	echo "db error";
	exit;
}

$page = paging("blog.php?page=", $pagecount, $pageno);
$result = $db->query("select * from po_blog where status>=0 and username='%s' order by id desc limit %d,%d", $username, $page['start'], $page['perpage']);

page_common($user['username'] . "的博客");
$t->set_file("body", "myblog.html");
$t->set_var("T_BLOGOWNER", $username);
$t->set_var("T_PAGING", $page['html']);
$t->set_block("body", "row", "aaa");
if ($user['username'] != $username) {
	$t->set_block("row", "selflink", "bbb");
}
if ($result) {
	while (($row = $db->fetch_assoc($result))) {
		$t->set_var("T_ID", $row['id']);
		$t->set_var("T_TITLE", $row['title']);
		$t->set_var("T_OWNER", $row['username']);
		$t->set_var("T_ADDTIME", $row['addtime']);
		$t->set_var("T_TAGS", tag_links($row['tags']));
		$t->set_var("T_CONTENT", format_content($row['content']));
		$t->parse("aaa", "row", true);
	}
}

$t->pparse("out", "body");

